package com.hspedu.enum_;

/**
 * @Author Stringzhua
 * @Date 2024/3/6 21:52
 * description:
 */
public class EnumExercise02 {
    public static void main(String[] args) {
        Week[] values = Week.values();
        for (Week week : values) {//增强for循环 遍历取出枚举对象
            System.out.println("week = " + week);
        }
        System.out.println("===============");
        //普通for循环
        for (int i = 0; i < values.length; i++) {
            System.out.println("week=" + values[i]);
        }
    }
}

enum Week{
    MONDAY("星期一"), TUESDAY("星期二"), WEDNESDAY("星期三"),
    THURSDAY("星期四"), FRIDAY("星期五"),
    SATURDAY("星期六"), SUNDAY("星期天");
    private String name;

    Week(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return "Week{" +
                "name='" + name + '\'' +
                '}';
    }
}
